samba同时用匿名和用户登录

        关于同时使用匿名和用户登录,配置文件如下,已经验证成功:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
[global]
workgroup = WORKGROUP
server string = Samba Server Version %v
log file = /var/log/samba/log.%m
max log size = 50
security = user
passdb backend = tdbsam
load printers = yes
cups iptions = raw
map to guest = bad user
guest account = nobody
encrypt password = yes
smb passwd file = /etc/samba/smbpasswd
[public]
comment = public
path = /data/pub/public
browseable = yes
guest ok = yes
writable = yes
printable = no
create mask = 0644
directory mask = 0755
[project]
comment = project
path = /data/pub/project
browseable = yes
public = no
guest ok = no
writeable = yes
force user = root
printable = no
create mask = 0644
directory mask = 0755

        注意:需要手动创建 /data/pub/public 和 /data/pub/project 目录,为了顺利完成试验,需要提前先改成 777 权限。

        另外还需创建用户:

1
2
[root@192 ~]# useradd testuser
[root@192 ~]# pdbedit -a testuser